package com.dxg.msns.common.pojo;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;

/**
 * 音乐打分实体类
 * 对应数据库表：music_grade
 * 
 * @author system
 */
@Table(name = "music_grade")
public class MusicGrade implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 音乐ID
     */
    @Column(name = "music_id")
    private String musicId;

    /**
     * 用户ID
     */
    @Column(name = "user_id")
    private String userId;

    /**
     * 音乐评分
     */
    @Column(name = "music_grade")
    private Integer musicGrade;

    /**
     * 创建时间
     */
    @Column(name = "creat_time")
    private Date createTime;

    /**
     * 删除时间
     */
    @Column(name = "delete_time")
    private Date deleteTime;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    private Date updateTime;

    /**
     * 状态：1-删除，0-正常，2-审核中
     */
    @Column(name = "status")
    private Integer status;

    // 构造方法
    public MusicGrade() {
    }

    public MusicGrade(String musicId, String userId, Integer musicGrade) {
        this.musicId = musicId;
        this.userId = userId;
        this.musicGrade = musicGrade;
        this.createTime = new Date();
        this.status = 0;
    }

    // Getter 和 Setter 方法
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMusicId() {
        return musicId;
    }

    public void setMusicId(String musicId) {
        this.musicId = musicId;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public Integer getMusicGrade() {
        return musicGrade;
    }

    public void setMusicGrade(Integer musicGrade) {
        this.musicGrade = musicGrade;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getDeleteTime() {
        return deleteTime;
    }

    public void setDeleteTime(Date deleteTime) {
        this.deleteTime = deleteTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "MusicGrade{" +
                "id=" + id +
                ", musicId='" + musicId + '\'' +
                ", userId='" + userId + '\'' +
                ", musicGrade=" + musicGrade +
                ", createTime=" + createTime +
                ", deleteTime=" + deleteTime +
                ", updateTime=" + updateTime +
                ", status=" + status +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        MusicGrade that = (MusicGrade) o;

        if (!musicId.equals(that.musicId))
            return false;
        return userId.equals(that.userId);
    }

    @Override
    public int hashCode() {
        int result = musicId.hashCode();
        result = 31 * result + userId.hashCode();
        return result;
    }
}